<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
String costFeeInfoJson= (String)request.getAttribute("costFeeInfoJson");
String success= (String)request.getAttribute("success");
%>
<link href="${basePath}/static/css/Pigeonhole/Pigeonhole_list.css"
	rel="stylesheet" type="text/css">
<link rel="stylesheet"
	href="${basePath}/static/css/medicalRecord_Search/medicalSearch.css" />
<script type="text/javascript"
	src="${basePath}/static/publics/assets/jqPaginator/jqPaginator.js"></script>
	<script type="text/javascript" src="${basePath}assets/js/echarts.js"></script>
<div class="list_NR">
	<div class="loc">
		<h3>统计报告</h3>
		<ul class="loc_loc">住院费用
		</ul>
	</div>

	<div class="list_con_table">
	
	<form id="infoListForm">
	<table style="width:100%;" cellpadding="0" cellspacing="0" id="table">
<tbody>

	<td colspan="6" style="text-align:right;">
			<input type="button" value="导出" class="btn"  onclick="exportCostFeeWord()">
			<input type="button" value="保存" class="btn"  onclick="saveCostFeeWord()">
	</td>
	
			<tr >
				 <td class="tdLabel_7" style="width:10%">
				 	住院费用指标
				 </td>
				<td class="tdLabel_8" style="width:988px">
					<textarea style="width:97%;height:300px" name="note">${costFeeInfo.costText}</textarea>
				</td>
			</tr>
			
			 <tr>
				 <td class="tdLabel_7">
				 	图(6)
				 </td>
				<td class="tdLabel_8" colspan="5" style="height:400px;">
						<div id="container" style="height: 400px;width:100%"></div>
					
				</td>
			 </tr>
			 
			  <tr>
				 <td class="tdLabel_7">
				 	说明
				 </td>
				<td class="tdLabel_8" colspan="5">
					<textarea style="width:95%;height:200px" id="costFeeNote">${costFeeInfo.costFeeNote}</textarea>
				</td>
			 </tr>
			
		

			
		</tbody>
</table>
</form>
</div>
</div>
	





<script>

var myChart;
function exportCostFeeWord(){
  
   var base64info = myChart.getDataURL();
   $.ajax({
      type:"post",
      data:{image:base64info,method:'getImage'},
      url:"${basePath}/report/exportCostFeeWord",
      success:function(data){
           window.location.href ="${basePath}/report/exportCostFeeWord?method=export";
      }
   })

   // window.location.href ="${basePath}/report/exportCostFeeWord?month="+month;
}

//保存费用相关信息
function saveCostFeeWord(){
   var costFeeNote = $("#costFeeNote").val();
   var costText = $("#costText").val();
   var base64info = myChart.getDataURL();
   $.ajax({
       type:"post",
       url:"${basePath}/report/saveCostFeeInfo",
       data:{costFeeNote:costFeeNote,costFeeBase64Image:base64info,costText:costText},
       success:function(data){
       		if(data.success){
       			layer.alert(data.msg,{icon:1});
       		}else{
       			layer.alert(data.msg,{icon:1});
       		}
       }
   });

}


 
 //初始化图表信息
 $(function(){
	var costFeeInfoJson= <%=costFeeInfoJson%>;
	if(null!=costFeeInfoJson){
	   initCharSet(costFeeInfoJson.costFeeChartRecord);
	}
	
 });
 
 

 

 //charset图表
 function initCharSet(params){
         
 	var dom = document.getElementById("container");
	myChart = echarts.init(dom);
	var app = {};
	option = null;
	app.title = '折柱混合';

	option = {
		tooltip: {
    		trigger: 'axis',
    		axisPointer: {
        	type: 'cross',
        	crossStyle: {
            	color: '#999'
        	}
    	}
	},

	legend: {
	    y: 'bottom',
    	data:['患者平均费用','药占比(%)','一次性耗材占比(%)']
	},
	xAxis: [
    	{
        	type: 'category',
        	data: params.monthList,
        	axisPointer: {
           		 type: 'shadow'
        	}
    	}
	],
	yAxis: [
    {
        type: 'value',
        name: '患者平均费用',
        axisLabel: {
            formatter: '{value}'
        }
    },
    {
        type: 'value',
        name: '占比(%)',
      /*   min: 0,
        max: 50,
        interval: 10, */
        axisLabel: {
            formatter: '{value}'
        }
    }
	],
	series: [
    {
        name:'患者平均费用',
        type:'bar',
        barWidth:90,
        data:params.avgFeeList
    },
    {
        name:'药占比(%)',
        type:'line',
		yAxisIndex: 1,
		barWidth:90,
        data:params.yabFeeList
    },
    {
        name:'一次性耗材占比(%)',
        type:'line',
        yAxisIndex: 1,
        barWidth:90,
        data:params.hczbFeeList
    }
	]
};
if (option && typeof option === "object") {
		myChart.setOption(option, true);
}
}
 
 



 

	
</script>